<template>
  <div class="tag-sys-process">
    <el-card>
      <tag-content-header refresh @toolFun="toolFun">
        <template #title>
          <span class="title-text">需求流程列表</span>
        </template>
      </tag-content-header>
      <tag-table
        ref="table"
        @refresh="getList"
        :data="dataList"
        :loading="loading"
        :columns="columns"
        :pagination="false"
      >
        <template #operation="{ scope }">
          <div class="operation-button-box">
            <el-tooltip effect="dark" content="绑定角色" placement="top" :enterable="false">
              <icon-svg name="iconLink" class="svg-view" @click.native="handleEdit(scope.row)"></icon-svg>
            </el-tooltip>
          </div>
        </template>
      </tag-table>
    </el-card>
    <process-dialog ref="processDialog" @refresh="getList"></process-dialog>
  </div>
</template>

<script>
import processDialog from './process-edit-item'
export default {
  components: {
    processDialog
  },
  data() {
    return {
      dataList: [],
      loading: false,
      columns: [
        {
          show: true,
          label: '流程名称',
          prop: 'procNm'
        },
        {
          show: true,
          label: '节点名称',
          prop: 'nodeNm',
          align: 'center'
        },
        {
          show: true,
          label: '绑定角色名称',
          prop: 'roleNm',
          align: 'center'
        },
        {
          show: 'fixed',
          label: '操作',
          prop: 'operation',
          align: 'center',
          width: 200
        }
      ]
    }
  },
  // created() {
  //   this.getList()
  // },
  methods: {
    getList() {
      this.loading = true
      this.$ajax({
        url: this.$ajax.setUrl('sys/sysProcNodeRole/review'),
        method: 'get',
        params: this.$ajax.setParams(this.params)
      }).then(({ data }) => {
        if (data && data.code === '0') {
          this.dataList = data.data
        } else {
          this.$message.error(data.data || data.msg)
        }
        this.loading = false
      })
    },
    toolFun(operation) {
      switch (operation) {
        case 'refresh':
          // 刷新动作
          this.getList()
          break
      }
    },
    handleEdit(scope) {
      this.$refs.processDialog.showDialog(scope)
    }
  }
}
</script>

<style lang="scss"></style>
